<!DOCTYPE html>
<html>
    <head>
        <title>  </title>
		<meta charset="utf-8" />
    </head>
    <body>

    </body>
    <script>
         //给页面添加一个随机背景颜色值
         /*var str = "0123456789abcdefghigklmn";
         var len = str.length;
         var colorStr = "#";
         for(var i = 0; i < 6; i++){
            var index = parseInt(len*Math.random());
            colorStr += str[index];
         }
         console.log(colorStr);
         document.body.style.backgroundColor = colorStr;//给页面添加背景颜色*/
          
         /*var index = 0;
         var arr = ["zahngsan","lisi","wangwu"];
         var str = "";
         switch(index){
             case "1":
                 str = arr[0];
             case 0:
                 str = arr[1];
            default:
                str = arr[2];
         }
         console.log(str);*/
         /*var a = 1;
         function f1(){
             var b = 2; var c = "2";
             function f2(){
                 var a = 0; var d = a+b+c;
                 console.log(d);
             }
             f2();
         }
         f1();*/
         /*function randomMixed(n) {
            var chars = [0,1,2,3,4,5,6,7,8,9,'a','b','c','d', 'e', 'f', 'g', 'h'];
            var res = "";
            for (var i = 0; i < n; i++) {
                var id = Math.ceil(Math.random() * 19);
                res += chars[id];
            }
         return res;
        }
        alert(randomMixed(6))*/
        function sortWork(arr){
            for(var i = 0; i < arr.length; i++){
                if(arr[i] < '0'||arr[i] > '9'){
                    var newarr = new Array();
                    newarr = arr.sort();
                    return newarr;
                }
                else
                    return '包含非数字参数';
            }
        }
        var arr1 = ["1", "5","2"];
        var result = sortWork(arr1);
        console.log(result);
    </script>
</html>